package com.example.stlink.activitys.fragmentChild.activityUserInfo;

import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageView;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.stlink.activitys.IdChooseActivity;
import com.example.stlink.R;
import com.example.stlink.utils.CommonUtils;

public class UserInfoSetting extends AppCompatActivity {

    private Button btExit;
    private Button btLoginOut;
    private ImageView abIvTitle;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_user_detail_setting);

        initView();
    }

    private void initView(){

        CommonUtils.changeStatusBar(this);
        btExit = findViewById(R.id.bt_exit);
        btLoginOut = findViewById(R.id.bt_login_out);
        abIvTitle = findViewById(R.id.ab_iv_title);

        setClickListener();
    }

    private void setClickListener(){
        btExit.setOnClickListener(v ->
                CommonUtils.exitApp(UserInfoSetting.this));

        btLoginOut.setOnClickListener(v -> {
            Intent intent = new Intent(UserInfoSetting.this, IdChooseActivity.class);
            //退出登录后，禁止再退回来
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
        });
        //返回上一个活动，也就是个人信息部分
        abIvTitle.setOnClickListener(v -> finish());
    }
}
